package com.mes.service.impl;


import com.mes.entity.MesEquipment;
import com.mes.mapper.MesEquipmentMapper;
import com.mes.service.MesEquipmentService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @BelongsPackage: com.mes.service.impl
 * @Author: 源源瞬转
 * @CreateTime: 2024-10-11  15:18
 * @Description TODO:
 */
@Service
public class MesEquipmentServiceImpl implements MesEquipmentService {

    @Autowired
    private MesEquipmentMapper mesEquipmentMapper;

    //设备管理条件分页查询
    @Override
    public Map listByPageByLike(Integer pageNum, Integer pageSize, MesEquipment mesEquipment) {
        Map map = new HashMap<>();
        int offset = (pageNum - 1) * pageSize;
        RowBounds rowBounds = new RowBounds(offset, pageSize);
        List<MesEquipment> list = mesEquipmentMapper.listByPageByLike(mesEquipment, rowBounds);
        map.put("list", list);
//      查询条件查询后的总数
        List<MesEquipment> listTotal = mesEquipmentMapper.listByPageByLike(mesEquipment);
        int total = listTotal.size();
        map.put("total", total);

        return map;
    }

}
